#pragma once

class Archive;

class PreferencesBlock{
public:
	PreferencesBlock(const char* name, bool editable);

	const char* name(){ return name_; }
	bool editable() const{ return editable_; }
	virtual void serialize(Archive& ar) {}
protected:
	const char* name_;
	bool editable_;
};

class PreferencesMaster{
public:
	static PreferencesMaster& the();

	void registerBlock(PreferencesBlock* block);
	void serialize(Archive& ar);

    void setFileName(const char* fileName);
	void save();
protected:
	PreferencesMaster();

	typedef std::vector<PreferencesBlock*> Blocks;
	Blocks blocks_;

	std::string fileName_;
};
